Micro Pump Click
Micro Pump Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Stefan Filipovic
- Date : Jan 2025.
- Type : ADC type
Software Support
Example Description
This example demonstrates the use of the Micro Pump Click board. It initializes the Click module, calibrates the offset for accurate current measurements, and then controls the motor in different states while measuring and logging the output current in milliamps (mA).
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.MicroPump
Example Key Functions
- micropump_cfg_setup Config Object Initialization function.
void micropump_cfg_setup(micropump_cfg_t *cfg)
Micro Pump configuration object setup function.
Micro Pump Click configuration object.
Definition micropump.h:140
- micropump_init Initialization function.
err_t micropump_init(micropump_t *ctx, micropump_cfg_t *cfg)
Micro Pump initialization function.
Micro Pump Click context object.
Definition micropump.h:125
- micropump_drive_motor This function drives the micro pump motor in the selected state.
void micropump_drive_motor(micropump_t *ctx, uint8_t state)
Micro Pump drive motor function.
- micropump_calib_offset This function calibrates the zero current offset value.
err_t micropump_calib_offset(micropump_t *ctx)
Micro Pump calib offset function.
- micropump_get_out_current This function reads the current output measurement in mA.
err_t micropump_get_out_current(micropump_t *ctx, float *current)
Micro Pump get out current function.
Application Init
Initializes the logger and the Micro Pump Click driver and performs offset calibration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Offset calibration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define MICROPUMP_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition micropump.h:112
void application_init(void)
Definition main.c:34
#define MIKROBUS_POSITION_MICROPUMP
Definition main.c:28
@ MICROPUMP_ERROR
Definition micropump.h:157
Application Task
Alternates the motor's operational states between COAST and FORWARD. For each state, it logs the motor's current consumption.
{
float current = 0;
log_printf( &logger, " Motor state : COAST\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
{
log_printf( &logger, " Current : %.3f mA\r\n\n", current );
}
log_printf( &logger, " Motor state : FORWARD\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
{
log_printf( &logger, " Current : %.3f mA\r\n\n", current );
}
}
#define MICROPUMP_MOTOR_COAST
Micro Pump motor control setting.
Definition micropump.h:91
#define MICROPUMP_MOTOR_FORWARD
Definition micropump.h:92
void application_task(void)
Definition main.c:70
@ MICROPUMP_OK
Definition micropump.h:156
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.